function  autoChangeBannerWidth() {
    var images = document.getElementsByClassName('banner-img-box')[0].children;
    var imagesWidth = document.getElementById('banner-img-view').offsetWidth;
    var countWidth = images.length * imagesWidth;
    var imgBox = document.getElementsByClassName('banner-img-box')[0];
    imgBox.style.width = countWidth+'px';
    for (var i = 0; i<images.length; i++){
        console.log(1);
        images[i].style.width = imagesWidth+'px';

    }
    console.log(imagesWidth);
}

function autoPlayBanner() {
    var imgBox = document.getElementsByClassName('banner-img-box')[0];
    var maxIndex = (document.getElementsByClassName('banner-img').length);
    var index = 1;
    setInterval(function () {
        var imagesWidth = document.getElementById('banner-img-view').offsetWidth;
        var offset = imagesWidth*index;
        var points = document.getElementsByClassName('banner-position')[0].children;

        //小红点
        var currentStyle = document.getElementsByClassName('bp-active')[0].className;
        currentStyle = currentStyle.replace(' bp-active', '');
        document.getElementsByClassName('bp-active')[0].className = currentStyle;
        points[index].className+= ' bp-active';

        index ++;
        imgBox.style.left = -offset+'px';

        if (index >=maxIndex){
            index = 0;
        }



    }, 3000);
}

autoChangeBannerWidth();
autoPlayBanner();